<?php

/**
 * 短信发送类，筑望
 * Class zhuwang
 */
    class zhuwang{
        public function __construct(){
        }
        public function send($phone, $content){
            $accountId  = SMS_ID;
            $account    = SMS_ACCOUNT;
            $pwd        = SMS_PWD;
            $url        = SMS_URL;
            $content    = SMS_PRE.$content;
            $content="action=send&userid={$accountId}&account={$account}&password={$pwd}&mobile={$phone}&content={$content}&sendTime=&extno=";
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url); //设置要请求的文件地址
            curl_setopt($ch, CURLOPT_TIMEOUT, "10"); //设置超时时间
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //设置是将获取的数据返回而不输出
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
            $res = curl_exec($ch); //执行这个curl
            curl_close($ch); //关闭curl
            $r=simplexml_load_string($res);

            if ($r->returnstatus == 'Success') { //发送成功
                return 0;
            } else {
                var_dump($res);
                return 1;//"错误信息：".var_export($res,1);
            }
        }

    }